Skip to content

feat: show 24h TWAP price on key detail page - #852

Merged
Chucks1093 merged 4 commits into
accesslayerorg:devfrom
mayborn005:fix/issue-827
Sep 5, 2026
Merged

feat: show 24h TWAP price on key detail page#852
Chucks1093 merged 4 commits into
accesslayerorg:devfrom
mayborn005:fix/issue-827

Conversation

@mayborn005

Copy link
Copy Markdown
Contributor

Closes #827

Summary

Displays the 24-hour time-weighted average price alongside the spot price on the key detail page, so buyers have a less manipulable reference before purchasing.

Changes

  • src/services/course.service.tsgetKeyTwap(keyId, window='24h') calls GET /keys/:keyId/twap?window=24h.
  • src/hooks/useKeyTwap.ts — React Query hook (60s stale, no retry).
  • src/lib/queryKeys.tscreators.twap.
  • src/pages/CreatorDetailPage.tsx — renders the TWAP card with:
    • Label TWAP (24h) and an info tooltip ("Time-weighted average key price over the last 24 hours.").
    • Loading skeleton while fetching.
    • Green TWAP label/delta when the spot price is above TWAP, red when below.
    • The card is hidden entirely when the endpoint returns null/no price (insufficient data).

Notes

  • Uses the existing formatDisplayKeyPrice for display.
  • CI/lint: the code is JSX + hooks consistent with the existing page; please run the frontend lint/build in CI.

@mayborn005

Copy link
Copy Markdown
Contributor Author

✅ TWAP (24h) is now shown alongside the spot price with colour-coded comparison and a loading skeleton. @accesslayerorg this PR resolves issue #827.

@mayborn005

Copy link
Copy Markdown
Contributor Author

@Chucks1093 CI syntax was checked on the issue branch; the TWAP implementation and Closes #827 PR documentation remain in place. Please rerun the verify check against the latest branch tip.

@mayborn005

Copy link
Copy Markdown
Contributor Author

@Chucks1093 The remaining verify failure is caused by malformed upstream merge-state files unrelated to #827: KeySimulationTool.tsx, SlippageToleranceSelector.tsx, slippageTolerance.utils.ts, and their tests. I inspected a repair, but did not push the broad rewrite because it would remove unrelated simulation/slippage functionality. The TWAP implementation itself remains intact; please resolve or restore those upstream files, then rerun verification.

@mayborn005

Copy link
Copy Markdown
Contributor Author

@accesslayerorg The TWAP implementation is present on this branch. The current verify failure is caused by malformed unrelated upstream simulation/slippage files, not the TWAP changes; I did not overwrite those files because that would remove unrelated functionality. Please repair the upstream files or rebase this branch onto a corrected base, then rerun verify.

@mayborn005

Copy link
Copy Markdown
Contributor Author

@accesslayerorg The TWAP implementation is present, but verify still fails because unrelated upstream simulation/slippage files are malformed. I left those files intact rather than replacing unrelated functionality. Rebase onto a corrected base before rerunning verify.

@mayborn005

Copy link
Copy Markdown
Contributor Author

@accesslayerorg CI fix pushed in 871a367. I restored the coherent simulation/slippage sources and removed the concatenated malformed implementations that caused verify to fail parsing. Targeted ESLint passes and the relevant 39 Vitest tests pass. GitHub verify is now rerunning on the updated head.

@Chucks1093

Copy link
Copy Markdown
Member

Please Fix Merge conflict

@Chucks1093

Copy link
Copy Markdown
Member

CI is green but this PR has a merge conflict with dev and cannot be auto-merged. Pull the latest dev into your branch with git fetch origin && git checkout your-branch && git merge origin/dev, resolve any conflicts, then run npm run build and npm run lint to confirm everything is clean before pushing.

@mayborn005

Copy link
Copy Markdown
Contributor Author

@accesslayerorg PR #852 conflict resolved and pushed. I rebased fix/issue-827 onto the latest dev, preserved the TWAP implementation and CI repair, and resolved the simulation/slippage history cleanly. New head: e777e6f. Targeted ESLint and 39 relevant Vitest tests pass locally. Please rerun CI.

@Chucks1093
Chucks1093 merged commit 24ed0b3 into accesslayerorg:dev Sep 5, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a TWAP price display on the key detail page alongside the bonding curve spot price

4 participants